package thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadDemo4 {
    public static void main(String[] args) {
        //创建固定大小的线程池
        ExecutorService executor = Executors.newFixedThreadPool(2);
        //提交任务
        executor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("hello world");
            }
        });
        //关闭线程池
        executor.shutdown();
    }
}
